package com.tpc.eb;



import com.tpc.eb.job.BusinessQuartz;
import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import lombok.SneakyThrows;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication

public class EBApplication extends AbstractJavaFxApplicationSupport {

    public static Stage stage;

    @Override
    public void start(Stage primaryStage) throws Exception {
        stage = primaryStage;
        Parent root = FXMLLoader.load(getClass().getResource("/fxml/FormMain.fxml"));
        stage.setScene(new Scene(root));
        stage.setWidth(860);
        stage.setHeight(600);
        stage.getIcons().add(new Image(getClass().getResourceAsStream("/ico/e5.png")));
        stage.setResizable(false);
        stage.centerOnScreen();
        stage.show();
        stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
            @SneakyThrows
            @Override
            public void handle(WindowEvent windowEvent) {
                BusinessQuartz businessQuartz = new BusinessQuartz();
                businessQuartz.businessJobStop();
            }
        });
    }

    public static void main(String[] args) {
        //启动(若需要以fxml形式展示主界面,则第二个传参可以为"MainStageView.class"之类的)
        launch(args);
    }

}